define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {

    var Controller = {
        index: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'ykjp/output/purchase/index' + location.search,
                    table: 'storage',
                }
            });

            var table = $("#table");

            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                sortName: 'id',
                exportTypes: ['excel'],
                exportOptions: {
                    fileName: '入库单' + Moment().format("YYYY-MM-DD"),
                    ignoreColumn: [0, 'operate'] //默认不导出第一列(checkbox)与操作(operate)列
                },
                columns: [
                    [
                        {checkbox: true},
                        {field: 'storage.code', title: __('Code')},
                        {field: 'supplier', title: __('Supplier'), operate: false},
                        {field: 'name', title: __('Name'), operate: false},
                        {field: 'price', title: __('Price'), operate: false},
                        {field: 'nums', title: __('Nums'), operate: false},
                        {field: 'prep_name', title: __('Prep_name'), operate: false},
                        {field: 'storage.inbound_type', title: __('Inbound_type'), searchList: {"1": __('Inbound 1'), "0": __('Inbound 0')}, formatter: Table.api.formatter.normal},
                        {field: 'createtime', title: __('Billing_time'), operate: 'RANGE', addclass: 'datetimerange', formatter: Table.api.formatter.datetime, datetimeFormat: "YYYY-MM-DD"},
                        {field: 'storage.rate', title: __('Rate'), operate: false},
                    ]
                ]
            });

            // 为表格绑定事件
            Table.api.bindevent(table);
        },
    };
    return Controller;
});




